<!--
内容：公共左侧栏
作者：mcl
日期： 20171110
-->
<template>
  <div class="left col-xs-12 col-sm-12 col-md-2 left-aside" id="js-leftAside">
    <ul class="nav-list">
      <!-- <li>下达指令</li> -->

      <!-- 将"激活时的CSS类名"应用在外层元素 li  -->
      <router-link tag="li" v-for="(data, index) in linkData" :to="data.url" :key="index">
        <icon :name="data.icon" class="icon-font-awe" scale="1.2"></icon>
        <dl>
          <dt>
            <router-link :to="data.url">{{ data.sort }}</router-link>
          </dt>
          <dd v-if="data.sortChild" v-for="(item, key, index) in data.sortChild">
            <router-link :to="item.url">{{ item.tit }}</router-link>
          </dd>
        </dl>
      </router-link>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'left',
  data () {
    return {
      linkData: [
        {
          sort: '首页',
          url: '/home',
          icon: 'home'
        },
        {
          sort: '文章管理',
          url: '/article-management',
          icon: 'search',
          sortChild: [
            {
              tit: '文章列表',
              url: '/article-management/article-list'
            }
          ]
        }
      ]
    }
  },
  methods: {
    showGame (data) {
      window.console.log('showGame+++++++++++++++', data)
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped="scoped" type="text/css">

  .left-aside {
    position: absolute;
    z-index: 3;
    left: 0;
    width: 250px;
    top: 60px;
    bottom:0;
    padding: 0;
    background: #f3f3f3;

  .nav-list {
    padding-left: 0;
    height: 100%;
    overflow-y: auto;

  li {
    position: relative;
    z-index: 1;
    margin-bottom: 10px;

  .icon-font-awe {
    position: absolute;
    z-index: 2;
    top: 10px;
    left: 30px;
    font-size: 18px;
  }

  &.router-link-active {

  dd {
    display: block;
  }

  .icon-font-awe {
    color: #fff;
  }

  }
  &:hover {

  dt {

  a {
    color: #fff;
    background: #409EFF;
  }

  }
  .icon-font-awe {
    color: #fff;
  }

  }

  a {
    display: block;
    padding: 5px 0 5px 60px;
    height: 40px;
    line-height: 30px;
    color: #333;
    text-decoration: none;
    text-align: left;

  &.router-link-active {
    color: #ddd;
  }

  }

    dl {
      margin: 0;

  dt {

  a {
    font-size: 14px;

  &.router-link-active {
    color: #fff;
    background: #409EFF;

  .icon-font-awe {
    color: #fff;
  }

  }
  }
  span {
    display: block;
    font-size: 12px;
  }

  }
        dd {
          display: none;
          height: 40px;
          background:#f3f3f3;

        a {
          padding: 7px 0 7px 30px;
          height: 40px;
          font-size: 12px;

        &.router-link-active {
          color: #333;
          border-left: 4px solid #409EFF;
          background: rgba(15, 114, 207, 0.3);
        }

        }
        span {
          display: block;
        }

        }
  }
  }
  }
  }
</style>
